#ifndef ENGINE_LINUX_H
#define ENGINE_LINUX_H

#include <GL/glx.h>
//#include <X11/extensions/xf86vmode.h>
#include <X11/keysym.h>
#include <map>

class Engine
{
public:
    Engine(void);
    ~Engine(void);

    bool init( const EngineParameters& params );
    void shutdown(void);
    void loop(void);
    void drawScene(void);
    void drawQuad(void);
    Object& addObject(void);

    static int loadTexture( const char* filename );


protected:

    void resizeWindow( unsigned int width, unsigned int height );
    void enableOpenGL(void);
    bool handleX11Events(void);
    void resize( unsigned int width, unsigned int height );
    void setKeyState( int keyCode, bool state );
    bool getKeyState( int keyCode );

    /// Window display pointer
	::Display* dpy;
	/// Window id
	::Window win;
	/// Rendering context
	::GLXContext ctx;
	/// Window attributes
	::XSetWindowAttributes attr;

    bool running;
    unsigned int width;
    unsigned int height;
    int screen;
    ILuint imageID;
    typedef std::map<int,bool> KeyCodeMap;
    KeyCodeMap keyMap;


    std::vector<Object> objetos;
};

#endif // ENGINE_LINUX_H
